package top.caoayu.configuration;

import org.springframework.context.annotation.Bean;
import top.caoayu.aspect.LogAspect;
import top.caoayu.dao.UserDaoImpl;
import top.caoayu.service.IMultipleService;
import top.caoayu.service.impl.Multiple1Service;
import top.caoayu.service.impl.Multiple2Service;
import top.caoayu.service.impl.UserServiceImpl;

//@EnableAspectJAutoProxy
//@Configuration
public class BeanConfig {
    @Bean("userService")
    public UserServiceImpl userService() {
        return new UserServiceImpl();
    }

    @Bean("userDao")
    public UserDaoImpl userDao() {
        return new UserDaoImpl();
    }

    @Bean("logAspect")
    public LogAspect logAspect() {
        return new LogAspect();
    }

    @Bean
    public IMultipleService multiple() {
        switch ("multiple") {
            case "multiple1":
                return new Multiple1Service();
            case "multiple2":
                return new Multiple2Service();
        }
        return null;
    }
}
